package edu.uaskl.jqf.playground;

import edu.uaskl.jqf.model.Qubit;
import edu.uaskl.jqf.model.gates.util.Gates;
import edu.uaskl.jqf.model.matrix.MatrixComplex;

public class ue5 {
    public static void main(final String[] args) {
        a1();
    }

    public static void a1() {
        final MatrixComplex q01 = Qubit.q0.tensor(Qubit.q1);

        final MatrixComplex H4 = Gates.HADAMARD.tensor(Gates.HADAMARD.getSize(2));
        final MatrixComplex H4Identity = Gates.HADAMARD.tensor(Gates.IDENTITY.getSize(2));
        final MatrixComplex U1 = new MatrixComplex(new double[][] { { 0, 1, 0, 0 }, { 1, 0, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } });
        System.out.println(H4.multiply(U1).multiply(H4).multiply(q01));
        System.out.println(H4Identity.multiply(U1).multiply(H4).multiply(q01));

        final MatrixComplex U2 = new MatrixComplex(new double[][] { { 0, 1, 0, 0 }, { 1, 0, 0, 0 }, { 0, 0, 0, 1 }, { 0, 0, 1, 0 } });
        System.out.println(H4.multiply(U2).multiply(H4).multiply(q01));
        System.out.println(H4Identity.multiply(U2).multiply(H4).multiply(q01));
    }
}
